package com.chinatechstar.admin.entity;

import java.io.Serializable;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.chinatechstar.component.commons.entity.CommonEntity;
import com.chinatechstar.component.commons.validator.InsertValidator;
import com.chinatechstar.component.commons.validator.UpdateValidator;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
 * 机构信息的实体类
 *
 * @版权所有 上海至界信息科技有限公司
 */
public class SysOrg extends CommonEntity implements Serializable {

    private static final long serialVersionUID = 6414776805478207026L;
    @NotNull(groups = {UpdateValidator.class})
    private Long id;// ID
    @NotBlank(groups = {InsertValidator.class, UpdateValidator.class})
    @Size(max = 64, min = 1, groups = {InsertValidator.class, UpdateValidator.class})
    private String orgName;// 机构名称
    @NotBlank(groups = {InsertValidator.class, UpdateValidator.class})
    @Size(max = 32, min = 1, groups = {InsertValidator.class, UpdateValidator.class})
    private String orgType;// 机构类型
    @Size(max = 256, groups = {InsertValidator.class, UpdateValidator.class})
    private String orgDescription;// 机构描述
    private Long orgSequence;// 排序
    private String tenantCode;// 租户编码
    private String ancestors;// 祖级列表

    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getOrgType() {
        return orgType;
    }

    public void setOrgType(String orgType) {
        this.orgType = orgType;
    }

    public String getOrgDescription() {
        return orgDescription;
    }

    public void setOrgDescription(String orgDescription) {
        this.orgDescription = orgDescription;
    }

    public Long getOrgSequence() {
        return orgSequence;
    }

    public void setOrgSequence(Long orgSequence) {
        this.orgSequence = orgSequence;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysOrg item = (SysOrg) o;
        return Objects.equal(id, item.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return MoreObjects
            .toStringHelper(this)
            .add("id", id)
            .add("orgName", orgName)
            .add("orgType", orgType)
            .add("orgDescription", orgDescription)
            .add("orgSequence", orgSequence)
            .add("tenantCode", tenantCode)
            .add("parentId", super.getParentId())
            .add("createTime", super.getCreateTime())
            .toString();
    }

}
